
package com.banach.prema.web;

import com.banach.prema.dto.cmd.ContactAdd;
import com.banach.prema.dto.cmd.ContactUpd;
import com.banach.prema.dto.vo.ContactVO;
import com.banach.prema.service.ContactService;
import com.ego.framework.annotation.Module;
import com.ego.framework.annotation.RestApi;
import com.ego.framework.dto.Response;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ajun
 *
 */
@RestController
@Module("联系人")
@RequestMapping(value = "/contact")
public class ContactController {
    @Resource
    private ContactService contactService;

    @GetMapping(value="/list")
    @RestApi(name = "查询联系人列表",idx = 0)
    public Response<List<ContactVO>> selectList() {
        return contactService.selectList();
    }

    @PostMapping(value="/create")
    @RestApi(name = "创建联系人",idx = 1)
    public Response create(@RequestBody ContactAdd contactAdd){
        return contactService.create(contactAdd);
    }

    @PutMapping(value="/update")
    @RestApi(name = "更新联系人",idx = 2)
    public Response update(@RequestBody ContactUpd contactUpd){
        return contactService.update(contactUpd);
    }
    @DeleteMapping(value="/delete")
    @RestApi(name = "删除联系人",idx = 3)
    public Response delete(@RequestBody List<Long> ids){
        return contactService.delete(ids);
    }
}